import { t } from '@src/locales'

const createFields = (f) => {
  const defaultField = {
    id: 5460,
    tableName: 'customer',
    isSystem: 1,
    fieldName: 'product',
    exportAlias: 'product',
    displayName: t('common.base.product'),
    formType: 'text',
    defaultValue: null,
    isNull: 1,
    isSearch: 1,
    placeHolder: null,
    setting: {},
    orderId: 1,
    isDelete: 0,
    guideProfessions: [],
    show: true,
    isGuideData: false,
    guideData: false,
  }
  return { ...defaultField, ...f }
}

const TaskReceiptSystemFields = [
  {
    id: 5460,
    isSystem: 1,
    fieldName: 'spare_name',
    field: 'spare_name',
    displayName: t('common.base.sparePart'),
    label: t('common.base.sparePart'),
    formType: 'text',
    isNull: 1,
    isSearch: 0,
  },
  {
    id: 5460,
    isSystem: 1,
    fieldName: 'service_name',
    field: 'service_name',
    displayName: t('common.form.type.serviceIterm'),
    label: t('common.form.type.serviceIterm'),
    formType: 'text',
    isNull: 1,
    isSearch: 0,
  },
  {
    id: 5460,
    isSystem: 1,
    fieldName: 'balance_total',
    field: 'balance_total',
    displayName: t('task.list.displayName.feeInfo'),
    label: t('task.list.displayName.feeInfo'),
    formType: 'text',
    isNull: 1,
    isSearch: 0,
  },
];

const LinkmanList = [
  {
    fieldName: 'tlmName',
    displayName: t('common.base.contact'),
    exportAlias: 'customerLinkman',
    formType: 'select',
  },
  {
    fieldName: 'tlmPhone',
    exportAlias: 'customerPhone',
    displayName: t('common.base.phone'),
    formType: 'text',
  },
].map(f => createFields(f));

const AddressList = [
  {
    id: 5460,
    tableName: 'customer',
    isSystem: 1,
    fieldName: 'taddress',
    exportAlias: 'customerAddress',
    displayName: t('common.form.type.customerAddress'),
    formType: 'address',
  },
].map(f => createFields(f));

const ProductList = [
  {
    fieldName: 'product',
    exportAlias: 'product',
    displayName: t('common.base.product'),
    formType: 'text',
  },
].map(f => createFields(f));

export {
  LinkmanList,
  AddressList,
  ProductList,
  TaskReceiptSystemFields
}